package org.dmikis.jmmengine.models;

public class TaskOneFunction implements DifferentiableFunction {

    public TaskOneFunction(double tay, double h, double Y00, double Y01, double Y10) {
	_tay = tay;
	_h = h;
	_y00 = Y00;
	_y01 = Y01;
	_y10 = Y10;
    }

    @Override
    public double df(double x) {
	return 1/(2*_tay) +
	   (2*Math.exp(2*x))/((1+Math.exp(2*x))*(4*_h));
    }

    @Override
    public double f(double x) {
	return (x-_y01+_y10-_y00)/(2*_tay) +
	   (Math.log(1+Math.exp(2*x))-Math.log(1+Math.exp(2*_y10))+Math.log(1+Math.exp(2*_y01))-Math.log(1+Math.exp(2*_y00)))/(4*_h);
    }
    
    private double _tay;
    private double _h;
    private double _y00;
    private double _y01;
    private double _y10;
}
